package com.gwnet.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gwnet.user.domain.CusUser;
import com.gwnet.user.mapper.CusUserMapper;
import com.gwnet.user.service.CusUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author WangLiang
 * @since 2024-07-20
 */
@Service
public class CusUserServiceImpl extends ServiceImpl<CusUserMapper, CusUser> implements CusUserService {

    private final CusUserMapper cusUserMapper;

    @Autowired
    public CusUserServiceImpl(CusUserMapper cusUserMapper) {
        this.cusUserMapper = cusUserMapper;
    }

    @Override
    public CusUser getUserByBizId(String bizId) {
        LambdaQueryWrapper<CusUser> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(CusUser::getBizUserId,bizId);
        List<CusUser> list = cusUserMapper.selectList(queryWrapper);
        if(list.size() > 0){
            return list.get(0);
        }
        return null;
    }
}
